package com.lb.videoplay.adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;

import com.blankj.utilcode.util.ImageUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lb.videoplay.R;
import com.lb.videoplay.model.AssortModel;

import java.util.List;

public class AssortAdapter extends BaseQuickAdapter<AssortModel, BaseViewHolder> {

    private Context mContext;

    public AssortAdapter(Context context, int layoutResId, @Nullable List<AssortModel> data) {
        super(layoutResId, data);
        this.mContext=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, AssortModel item) {
        helper.setText(R.id.tv_name,"#"+item.getType_name());
        BitmapDrawable bd = (BitmapDrawable) mContext.getResources().getDrawable(item.getPic());
        final Bitmap bmm = bd.getBitmap();
        helper.setImageBitmap(R.id.iv_assort,ImageUtils.toRoundCorner(bmm, 30));

        helper.addOnClickListener(R.id.ll_recharge);
    }
}
